﻿<UserControl x:Class="GEPL.StandardModulesLibrary.Views.Console.ConsoleWriteView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:p="clr-namespace:GEPL.StandardModulesLibrary.Properties"
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
             xmlns:vm="clr-namespace:GEPL.StandardModulesLibrary.ViewModels.Console"
             mc:Ignorable="d"
             Height="200"
             Width="200" d:DataContext="{d:DesignInstance vm:ConsoleWriteViewModel}">
    <DockPanel LastChildFill="True">
        <Grid DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <CheckBox x:Name="NewLineCheckBox"
                      Grid.Column="0"
                      Content="{x:Static p:Resources.Miscs_NewLine}"
                      Margin="2,2,2,2"
                      IsChecked="{Binding WriteLine, Mode=TwoWay}" />
            <Button Grid.Column="1"
                    Margin="5,0"
                    Content="{x:Static p:Resources.Miscs_Remove}"
                    Command="{Binding RemoveTextBoxCommand}" />
            <Button Grid.Column="2"
                    Content="{x:Static p:Resources.Miscs_Add}"
                    Command="{Binding AddTextBoxCommand}" />
        </Grid>
        <ListView ItemsSource="{Binding WriteList}"
                  SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
                  dd:DragDrop.IsDragSource="True"
                  dd:DragDrop.IsDropTarget="True"
                  HorizontalContentAlignment="Stretch">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="10,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBox Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                 Grid.Row="0" />
                        <CheckBox IsChecked="{Binding Variable, Mode=TwoWay}"
                                  Grid.Row="1"
                                  Content="{x:Static p:Resources.ConsoleWrite_AsVariable}" />
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </DockPanel>
</UserControl>